﻿#ifndef UDPRECORD_H
#define UDPRECORD_H

#include <QAudioBuffer>
#include <QAudioInput>
#include <QBuffer>
#include <QObject>
#include <QUdpSocket>

class UDPRecord : public QObject
{
    Q_OBJECT
public:
    explicit UDPRecord(QString ip,quint16 port,QObject *parent = nullptr);
    ~UDPRecord(void);
signals:

public slots:
    void processData(void);
    void startAudio(void);
    void stopAudio(void);
private slots:
    void handleNotify(const QAudioBuffer &buffer);


private:
    QString remoteIp = QString("192.168.31.114");
    quint16 remotePort = 1002;
    QAudioInput* audioInput = nullptr;
    QUdpSocket* sendSocket = nullptr;
    QIODevice* recordIODevice  = nullptr;
    QAudioFormat format;
    QBuffer buffer;

};

#endif // UDPRECORD_H
